<?php
$profileId=$_SESSION['profileid'];
if(isset($_GET['date3']))
{
	$startDate = $_GET['date3'];
} else {
	$tanggalmulai= date('Y-m-d', strtotime('-1 month'));
	$startDate = $tanggalmulai;
}
if(isset($_GET['date4']))
{
	$endDate = $_GET['date4'];
} else {
$endDate = date('Y-m-d');
}
if(isset($_GET['dimension']))
{
	$dimension = $_GET['dimension'];
} else {
$dimension = "ga:date";
}
?>
<h2 align = "center">Clicks</h2>
<div class = "row" >
<?php
 $CParams = array(
      'dimensions' => 'ga:fullReferrer'
      
      
      );
$resultsC = $analytics->data_ga->get(
       'ga:' . $profileId,
       $startDate,
       $endDate,
	   'ga:sessions',
       $CParams
	   );
	   
?>
<script type="text/javascript">
            var chartDataC = [
		<?php
    // Print table rows.
		$x=1;
		foreach ($resultsC->getRows() as $row) {
      
		?>
		{
			"Path": "<?php echo $row[0]; ?>",
			"pageView": <?php echo $row[1]; ?>
		}
		<?php
		if($x>=sizeof($resultsC->getRows()))
		{
		?>
		<?php
		}
		else
		{
		?>
		,
		<?php
		}
		$x++;

     
		}
		?>
		];
</script>
</div>



<script type="text/javascript">
             var chartC;

                        AmCharts.ready(function () {
                // SERIAL CHART
                chartC = new AmCharts.AmSerialChart();
                chartC.dataProvider = chartDataC;
                chartC.categoryField = "Path";
                // this single line makes the chartC a bar chartC,
                // try to set it to false - your bars will turn to columns
                chartC.rotate = true;
                // the following two lines makes chartC 3D
                chartC.depth3D = 20;
                chartC.angle = 30;

                // AXES
                // Category
                var categoryAxis = chartC.categoryAxis;
                categoryAxis.gridPosition = "start";
                categoryAxis.axisColor = "#DADADA";
                categoryAxis.fillAlpha = 1;
                categoryAxis.gridAlpha = 0;
                categoryAxis.fillColor = "#FAFAFA";

                // value
                var valueAxis = new AmCharts.ValueAxis();
                valueAxis.axisColor = "#DADADA";
                valueAxis.title = "";
                valueAxis.gridAlpha = 0.1;
                chartC.addValueAxis(valueAxis);

                // GRAPH
                var graph = new AmCharts.AmGraph();
                graph.title = "pageView";
                graph.valueField = "pageView";
                graph.type = "column";
                graph.balloonText = "";
                graph.lineAlpha = 0;
                graph.fillColors = "#bf1c25";
                graph.fillAlphas = 1;
                chartC.addGraph(graph);

                chartC.creditsPosition = "top-right";

                // WRITE
                chartC.write("chartC");
            });
</script>

<div class = "row" >

<div id="chartC" style="width: 100% ; height: 800px;"></div>
</div>